import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import edu.indiana.cs.b534.torrent.TorrentMetainfo;
import edu.indiana.cs.b534.torrent.context.TorrentContext;
import edu.indiana.cs.b534.torrent.impl.TorrentManager;
import edu.indiana.cs.b534.torrent.struct.TorrentMetainfoImpl;


public class Seed {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

	        final File testTorrent = new File("resources/freeculture.Team_6.pdf.torrent");
	        try {
				Properties p = new Properties();
				FileInputStream in = new FileInputStream("resources/bittorrent1.properties");
				p.load(in);
				in.close();
				TorrentMetainfo meta =
				        TorrentMetainfoImpl.deserialize(new BufferedInputStream(new FileInputStream(testTorrent)));
				TorrentContext torrentContext = new TorrentContext(p);

				TorrentManager manager = new TorrentManager(meta, torrentContext);
				manager.run();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
	}

}
